package com.success;

import com.netflix.loadbalancer.RoundRobinRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 用户服务主配置类
 * @EnableDiscoveryClient :开启服务发现 (开启注册中心的客户端功能)
 * @EnableEurekaClient : 开启Eureka client客户端(只是针对Eureka有用)
 */
//@EnableDiscoveryClient
//@EnableEurekaClient
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker//集成豪猪
public class SpringCloudConsumersPayServer300Application{
    public static void main( String[] args )
    {

        SpringApplication.run(SpringCloudConsumersPayServer300Application.class,args);
    }

    //这是注入负载均衡器
    @LoadBalanced
    @Bean
    public RestTemplate getTemplate(){
        return new RestTemplate();
    }

    @Bean
    public RoundRobinRule getRoundRobin(){
        return new RoundRobinRule();
    }

}
